﻿<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>上传版本</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <div th:include="layout/resources :: resources"></div>
</head>
<body>
<div class="container">
    <div style="margin-top: 50px;">
        <form id="form" class="form-horizontal" th:action="@{/versionInfo/add}" enctype="multipart/form-data" method="post">
            <div class="form-group">
                <label for="type" class="col-sm-2 control-label">项目名</label>
                <div class="col-sm-10">
                    <select class="form-control" name="type" id="type">
                        <option value="1">行车记录仪</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="updatePkg" class="col-sm-2 control-label">升级包</label>
                <div class="col-sm-10">
                    <input type="file" class="form-control" id="updatePkg" name="updatePkg">
                </div>
            </div>
            <div class="form-group">
                <label for="remark" class="col-sm-2 control-label">备注</label>
                <div class="col-sm-10">
                    <textarea class="form-control" id="remark" name="remark"></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default">上传</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script th:inline="javascript">
    $(function () {
        init();
    });

    function init() {

    }

    function add() {
        $("#form").ajaxSubmit({
            type: "POST",//提交类型
            dataType: "json",//返回结果格式
            url: createUrl("/versionInfo/add"),//请求地址
            success: function (result) {//请求成功后的函数
                if (result.errorCode == 0) {
                    framework.successMsg("添加成功");
                } else {
                    framework.errorMsg("添加失败");
                }
            },
            async: true
        });
    }
</script>
</html>
